filesize
Physical disk space use retrieval.
filesize
abstracts platform-specific methods of determining the real space used
by files, taking into account filesystem compression and sparse files.
use ;
let realsize = file_real_size?;
// Save a stat() on Unix
let also_realsize = file_real_size_fast?;
Now, please stop writing du
clones that only take apparent size into account.
Supported Platforms
Unix
On Unix platforms this is a thin wrapper around std::fs::symlink_metadata()
and std::os::unix::fs::MetadataExt
, simply returning blocks() * 512
.
Windows
On Windows this wraps GetCompressedFileSizeW()
.
Everything Else
All other platforms receive a fallback that simply returns the logical file size.